package com.gjs.freechat.web.session;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.gjs.freechat.server.component.bean.UserInfo;

public class SessionManager {
	public static boolean isLogined(HttpSession session) {
		//Authorization authorization = (Authorization) session.getAttribute("authorization");
//		if (authorization != null)
//			return authorization.isLogined();
		UserInfo userinfo = (UserInfo) session.getAttribute("userInfo");
		if (userinfo != null)
			return userinfo.getLogined() == 1 ? true : false;
		
		return false;
	}
	
	public static boolean isLogined(HttpServletRequest request) {
		return isLogined(request.getSession());
	}
	
}
